package org.hit.burkun.umls.relation.merge;


import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;

import org.hit.burkun.entities.Entity;
import org.hit.burkun.umls.relation.UniformRelation;

public class HpClinvarMerge {

	public static void main(String[] args) {

		HashMap<String, LinkedList<GeneMergeObject>> res = mergeHpAll();
		Collection<String[]> data = StaticMethods
				.formatToEntity2GeneDbRelWithoutPrimaryId(res,
						Entity.TYPE.HP_ONTOLOGY);
		StaticMethods.dumpRelationsWithoutPrimaryId(data, "merge_birelation");
	}

	private static HashMap<String, LinkedList<GeneMergeObject>> mergeHpAll() {
		HashMap<String, LinkedList<GeneMergeObject>> oldRes1 = StaticMethods
				.getEntity2Entity(UniformRelation.TYPE.HP_ANNOTATION_GENE_ICE);
		HashMap<String, LinkedList<GeneMergeObject>> oldRes2 = StaticMethods
				.getEntity2Entity(UniformRelation.TYPE.HP_ANNOTATION_GENE_IEA);
		HashMap<String, LinkedList<GeneMergeObject>> oldRes3 = StaticMethods
				.getEntity2Entity(UniformRelation.TYPE.HP_ANNOTATION_GENE_PCS);
		HashMap<String, LinkedList<GeneMergeObject>> oldRes4 = StaticMethods
				.getEntity2Entity(UniformRelation.TYPE.HP_ANNOTATION_GENE_TAS);
		// 不使用自带的gene关系
		// HashMap<String, LinkedList<GeneMergeObject>> oldRes5 =
		// StaticMethods.getEntity2Entity(UniformRelation.TYPE.HP_FILE_GENE);
		//clinvar
		HashMap<String, LinkedList<GeneMergeObject>> newRes1 = StaticMethods
				.mergeFromEntityByUmls(Entity.TYPE.HP_ONTOLOGY, UniformRelation.TYPE.DISEASE_CLINVAR_GENE);
		//omim
		HashMap<String, LinkedList<GeneMergeObject>> newRes2 = StaticMethods
				.mergeFromEntityByUmls(Entity.TYPE.HP_ONTOLOGY, UniformRelation.TYPE.OMIM_GENE);
		//ctd
		HashMap<String, LinkedList<GeneMergeObject>> newRes3 = StaticMethods
				.mergeFromEntityByUmls(Entity.TYPE.HP_ONTOLOGY, UniformRelation.TYPE.DISEASE_CTD_GENE_CURATED);
		// System.out.println(oldRes1.size()); //1
		// System.out.println(oldRes2.size()); //1122
		// System.out.println(oldRes3.size()); //87
		// System.out.println(oldRes4.size()); //788
		// System.out.println(oldRes5.size()); //6918
		// System.out.println(newRes.size()); //242
		oldRes2 = StaticMethods.merge(oldRes1, oldRes2);
		oldRes2 = StaticMethods.merge(oldRes3, oldRes2);
		oldRes2 = StaticMethods.merge(oldRes4, oldRes2);
		// oldRes2 = StaticMethods.merge(oldRes2, oldRes5);
		oldRes2 = StaticMethods.merge(newRes1, oldRes2);
		oldRes2 = StaticMethods.merge(newRes2, oldRes2);
		oldRes2 = StaticMethods.merge(newRes3, oldRes2);
		// System.out.println(oldRes2.size());

		return oldRes2;
	}
}
